package com.msh.frame.client.base;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(title = "BasePageQo")
@JsonIgnoreProperties(value = "firstRow", ignoreUnknown = true)
public interface BasePageQo<T extends BasePageQo> {

  Integer getCurrentPage();

  Integer getPageSize();

  T setPageSize(Integer pageSize);

  T setCurrentPage(Integer pageSize);

  @JSONField(serialize = false)
  default Integer getFirstRow() {
    return (getCurrentPage() - 1) * getPageSize();
  }
}
